package com.jd.action;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import com.jd.po.BatFile;
import com.jd.po.User;
import com.jd.service.CreateBatFilesService;
import com.jd.tools.DateTool;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class CreateBatFilesAction extends ActionSupport {
	private CreateBatFilesService createBatFilesService;
	
	public String execute() throws Exception {
		HttpServletResponse response = ServletActionContext.getResponse();
		HttpServletRequest request = ServletActionContext.getRequest();
		Map session = ActionContext.getContext().getSession();
		User user = (User) session.get("user");
		String onLineType = request.getParameter("onLineType");
		String testType = request.getParameter("testType");
		String projectName = request.getParameter("projectName");
		String selectValue = request.getParameter("selectValue");
		String domainName = request.getParameter("domainName");
		BatFile bf = new BatFile();
		bf.setDomainName(domainName);
		bf.setFilesStr(selectValue.substring(0, selectValue.length()-1));
		bf.setOnLineType(onLineType);
		bf.setProjectName(projectName);
		bf.setTestType(testType);
		bf.setTime(DateTool.getCurrentYMD());
		createBatFilesService.createBat(bf, user);
		return null;
	}

	public void setCreateBatFilesService(CreateBatFilesService createBatFilesService) {
		this.createBatFilesService = createBatFilesService;
	}

	public CreateBatFilesService getCreateBatFilesService() {
		return createBatFilesService;
	}


}
